package com.lishanyang.structs.action;

import com.lishanyang.structs.unity.User;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.interceptor.ServletRequestAware;

import javax.servlet.http.HttpServletRequest;

public class JsonAction extends ActionSupport implements ServletRequestAware {
    private HttpServletRequest request;
    private User user;

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String execute() {
//        user = new User();
//        user.setId(123);
//        user.setName("Irasel");
        request.setAttribute("message","come from HttpServletRequest!");
        return SUCCESS;
    }

    @Override
    public void setServletRequest(HttpServletRequest httpServletRequest) {
        this.request=httpServletRequest;
    }
}
